{extend name="layout:base" /}{block name="content"}

<?php
$global=isSupperManagerForSession();
?>
<link rel="stylesheet" type="text/css" href="/static/My97DatePicker/skin/WdatePicker.css" />
<script charset="utf-8" src="/static/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
    .yg_inp>input{margin-bottom: 10px;}
    #zc_detail table{margin:10px;}
    #zc_detail table tr td{border: 1px solid #ddd;height:40px;line-height:40px;padding-left:5px;padding-right:5px;}
    .ordertable input {width:90%;}
    .policeLable{padding:2px 4px;margin-left:4px;}
    #taskDate .taskDateItem{width:100%;height:40px;line-height:40px;margin:4px 0px;}
    #taskDate .taskDateItem .taskDateItemLeft{width:10%;float:left;}
    #taskDate .taskDateItem .taskDateItemRight1{width:70%;float:left;border:1px solid #139667;height: 42px;}
    #taskDate .taskDateItem .taskDateItemRight2{width:20%;float:right;}
    #taskDate .taskDateItem .opUsers img{width:22px;margin-left:5px;}
    #taskDate .taskDateItem .itemUser{padding: 4px 6px;background:#139667;margin-left:4px;color:white;}
    #taskDate .taskDateItem .clear{clear:both;width:0px;height:0px;overflow:hidden;}
    #taskDate .taskDateItem .jia,#taskDate .taskDateItem .jian{font-size:30px;cursor:pointer;font-weight:800;margin-left:5px;}
</style>

<!--引入JS-->
<script type="text/javascript" src="/static/admin/js/ajaxfileupload.js?t=1"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/static/ueditor/lang/zh-cn/zh-cn.js"></script>

<section class="topBanners">
         <div class="icon"></div>
         <div class="topBannersNav">
        <span data-url="/admin/rentdevice/lists" onclick="ContentLoadGo('/admin/rentdevice/lists')">设备管理</span>
         >
         <span data-url="/admin/rentdevice/addData"  onclick="ContentLoadGo('/admin/rentdevice/addData')"  >添加</span>
         </div>
</section>
<section id="zc_detail">
<table class="ordertable" style="width:100%;" border="0" cellspacing="0" cellpadding="0">

    <tr>
        <td width="120"><div align="right">设备类型</div></td>
        <td class="tr_cons">
            <select id="device_type" class="select" name="data[device_type]">
                <option value="">--设备类型--</option>
                <?php
                foreach($tyList as $key=>$val)
                {
                ?>
                <option value="<?php echo $key; ?>" <?php if($info['device_type']==$key){echo 'selected';} ?> ><?php echo $val; ?></option>
                <?php
                }
                ?>
            </select>
        </td>
    </tr>
    <tr>
        <td width="120"><div align="right">设备序列号</div></td>
        <td class="tr_cons">
            <input type="text" name="data[device_sn]" id="device_sn" value="<?php echo $info['device_sn']; ?>" placeholder="" class="textbox" style="padding:0px;" />
        </td>
    </tr>

    <tr>
        <td width="120"><div align="right">设备型号</div></td>
        <td class="tr_cons">
            <input type="text" name="data[device_model]" id="device_model" value="<?php echo $info['device_model']; ?>" placeholder="" class="textbox" style="padding:0px;" />
        </td>
    </tr>

    <tr>
        <td width="120"><div align="right">租用价格</div></td>
        <td class="tr_cons">
            <input type="text" name="data[rent_price]" id="rent_price" value="<?php echo $info['rent_price']; ?>" placeholder="" class="textbox" style="padding:0px;width:120px;" />
       元
        </td>
    </tr>
    <tr>
        <td width="120"><div align="right">押金</div></td>
        <td class="tr_cons">
            <input type="text" name="data[deposit_price]" id="deposit_price" value="<?php echo $info['deposit_price']; ?>" placeholder="" class="textbox" style="padding:0px;width:120px" />
        元
        </td>
    </tr>

    <tr>
        <td width="120"><div align="right">解读价格</div></td>
        <td class="tr_cons">
            <input type="text" name="data[explain_price]" id="explain_price" value="<?php echo $info['explain_price']; ?>" placeholder="" class="textbox" style="padding:0px;width:120px" />
            元
        </td>
    </tr>

    <tr>
        <td width="120"><div align="right">是否上架</div></td>
        <td class="tr_cons">
            <select name="data[stats]" id="stats" class="select">
                <option value="0" <?php if($info['stats']=='0'){echo 'selected';} ?> >上架</option>
                <option value="1" <?php if($info['stats']=='1'){echo 'selected';} ?> >下架</option>
            </select>
        </td>
    </tr>
    <tr>
        <td width="120"><div align="right">位置</div></td>
        <td class="tr_cons">
            <select id="position_id" class="select" name="data[position_id]">
                <option value="">--位置--</option>
                    <?php
                foreach($positionLists as $k=>$v){
                        ?>
                        <option value="<?php echo $v['id']; ?>" <?php if($info['position_id']==$v['id']){echo 'selected';} ?> ><?php echo $v['name'] ?></option>
                        <?php
                }
                ?>
            </select>
        </td>
    </tr>




     <tr>
       <td style="height:50px;text-align:center;" colspan="2">
			<input type="button" power="70000"  style="width:80px;margin-top:4px;margin-bottom:4px;padding:0px;" value="添加" class="link_btn add"/>
       </td>
     </tr>
   </table>
</section>


<script type="text/javascript">
function uploadPic()
{
    $.ajaxFileUpload({
        url: '/api/face/uploadImage1', //用于文件上传的服务器端请求地址
        secureuri: false, //是否需要安全协议，一般设置为false
        fileElementId: 'fileImage', //文件上传域的ID
        dataType: 'text/plain', //返回值类型 一般设置为json
        success: function (data, status) //服务器成功响应处理函数
        {
         if(data.err==0)
           {
               var img='<a href="'+data.data.pic+'" target="_blank"><img src="'+data.data.pic+'" style="width:120px;margin:5px;" />';
           $("#updateimg").html(img);
           $("#uImage").val(data.data.pic);
           }
       },
       error: function (data, status, e)//服务器响应失败处理函数
       {
        alert(e);
       }
    })
   return false;
}

function myResearch(){
   var url="/admin/rentdevice/addData";
   var param={
   };
   ContentGet(url,param);
}
    
      
$(function(){
    var gnum=0;
    var lastObj;
    //设置搜索栏
    $(".research").click(function(){
       var page =$(this).attr("page");
       $("#cpage").val(page);
       myResearch();
    });

    $(".add").unbind().bind("click",function(){

        var that =this;
        var url="/admin/rentdevice/addData";
        var generaData=$("[name^='data']");
        var device_type=$("#device_type").val();
        if(device_type=="")
        {
            alert("请选择设备类型");return fasle;
        }


        var device_sn=$("#device_sn").val();
        if(device_sn=="")
        {
            alert("设备序列号不能为空");return fasle;
        }

        var device_model=$("#device_model").val();
        if(device_model=="")
        {
            alert("设备型号不能为空");return fasle;
        }

        var param={
                data:{},
                sys_opt:'addData'//后台判断编辑操作
        };
        getFormData(generaData,param.data);
        AjaxRequest(url,param,function(data){
            if(data.err==0) {
                SuccessTiShi("操作成功");
                ContentLoadGo("/admin/rentdevice/lists");
            } else
            {
                ErrTiShi(data.msg);
            }
        });
    });

    //导航
    $(".topBannerItem").click(function(){
       var attArr = $(this).attr();
       goToSelfLink(attArr);
    });
});
</script>
{/block}